package org.stu.dao.hibernate;

import org.stu.dto.User;
import org.stu.dto.UserType;
import org.hibernate.*;
import org.hibernate.cfg.Configuration;





public class HibernateDAO  {
	static SessionFactory sessionFactory;
	static 		Session session;
	static{
		try {

			Configuration config=new Configuration().configure();
			sessionFactory=config.buildSessionFactory();
	
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	public void saveUser(User user){
		session=sessionFactory.openSession();
		System.out.print(session.toString());
		session.save(user);
		session.close();
	}
	public void saveUserType(UserType user){
		session=sessionFactory.openSession();
		session.save(user);
		System.out.print(session.toString());
		session.close();
		
		}
}
